﻿using System;
using System.Collections.Generic;
using DMS.Data;
using DMS.Business.Modules.SystemManagement;
using DMS.Business.Utility;
using DMS.Business.Modules.Organization;

namespace DMS.Web.Modules.ArchivesManagement
{
    public partial class ZHInfoList : System.Web.UI.Page
    {
        #region 属性

        private AuthenticationUser _loginUser;
        private AuthenticationUser LoginUser
        {
            get
            {
                if (_loginUser == null)
                {
                    _loginUser = SystemContext.Current.LoginAuthUser;
                }
                return _loginUser;
            }
        }

        /// <summary>
        /// normal/urge/overtime/warning/complain/unPrint/unArrive/unBack
        /// </summary>
        public string FormType
        {
            get
            {
                return Request["type"];
            }
        }

        #endregion

        protected void Page_Load(object sender, EventArgs e)
        {
            if (!IsPostBack)
            {
                InitControls();
                //Search();
            }
            //CurrentPage.Checked = false;
        }

        private void InitControls()
        {
            this.currentListName.Text = "综合资料信息";
        }

        private void Search()
        {
            //int total;
            //string condition = GetCondition();
            ////缓存到页面隐藏字段
            //this.Condition.Value = condition;

            //if(this.PageSize.Text=="")
            //    this.PageSize.Text = "15";
            //pager.PageSize = int.Parse(this.PageSize.Text);
            //List<PS_Orders> list = OrderFormService.GetOrders(SystemContext.Current.LoginAuthUser, condition, pager.CurrentPageIndex, pager.PageSize, out total);
            
            //Orders = list;

            //foreach (GridViewRow gr in gvList.Rows)
            //{
            //    HtmlInputCheckBox cb = (HtmlInputCheckBox)gr.Cells[0].FindControl("chkItem");
            //    string id = cb.Attributes["value"].Split(',')[0];
            //    if (ViewState[id] != null)
            //    {
            //        ViewState.Remove(id);
            //    }
            //}
            //gvList.DataSource = list;
            //gvList.DataBind();

            //pager.RecordCount = total;
        }

//        protected string GetCondition()
//        {
//            string condition = "";

//            string inputOrderNo = txtOrderNo.Text.Replace(",", "").Replace("'", "").Trim();
//            using (StringReader sr = new StringReader(inputOrderNo))
//            {
//                StringBuilder inString = new StringBuilder();
//                string strLineData;
//                int i = 0;
//                while ((strLineData = sr.ReadLine())!=null)
//                {
//                    if (strLineData.Trim() != "")
//                    {
//                        strLineData = strLineData.Trim();
//                        inString.Append("'" + strLineData + "',");
//                        i++;
//                    }
//                }
//                if (i > 1)
//                {
//                    condition += " and it.OrderNo in {" + inString.ToString().Substring(0, inString.Length - 1) + "}";
//                }
//                else
//                {
//                    if (txtOrderNo.Text != "")
//                    {
//                        condition += string.Format(" and it.OrderNo like '%{0}%'", txtOrderNo.Text.Trim());
//                    }
//                }
//            }

//            string inputSourceNo = txtSourceNo.Text.Replace(",", "").Replace("'", "").Trim();
//            using (StringReader sr = new StringReader(inputSourceNo))
//            {
//                StringBuilder inString = new StringBuilder();
//                string strLineData;
//                int i = 0;
//                while ((strLineData = sr.ReadLine())!=null)
//                {
//                    if (strLineData.Trim() != "")
//                    {
//                        strLineData = strLineData.Trim();
//                        inString.Append("'" + strLineData + "',");
//                        i++;
//                    }
//                }
//                if (i > 1)
//                {
//                    condition += " and it.SourceNo in {" + inString.ToString().Substring(0, inString.Length - 1) + "}";
//                }
//                else
//                {
//                    if (txtSourceNo.Text != "")
//                    {
//                        condition += string.Format(" and it.SourceNo like '%{0}%'", txtSourceNo.Text.Trim());
//                    }
//                }
//            }

//            string inputCarryNo = txtCarryNo.Text.Replace(",", "").Replace("'", "").Trim();
//            using (StringReader sr = new StringReader(inputCarryNo))
//            {
//                StringBuilder inString = new StringBuilder();
//                string strLineData;
//                int i = 0;
//                while ((strLineData = sr.ReadLine())!=null)
//                {
//                    if (strLineData.Trim() != "")
//                    {
//                        strLineData = strLineData.Trim();
//                        inString.Append("'" + strLineData + "',");
//                        i++;
//                    }
//                }
//                if (i > 1)
//                {
//                    condition += " and it.CarryNo in {" + inString.ToString().Substring(0, inString.Length - 1) + "}";
//                }
//                else
//                {
//                    if (txtCarryNo.Text != "")
//                    {
//                        condition += string.Format(" and it.CarryNo like '%{0}%'", txtCarryNo.Text.Trim());
//                    }
//                }
//            }
//            if (txtApplier.Text != "")
//            {
//                condition += string.Format(" and it.Applier like '%{0}%'", txtApplier.Text.Trim());
//            }
//            if (txtApplierBigDept.Text != "")
//            {
//                condition += string.Format(" and it.ApplierBigDept like '%{0}%'", txtApplierBigDept.Text.Trim());
//            }
//            if (txtBeginInitialTime.Text != "")
//            {
//                condition += string.Format(" and it.InitialTime >= cast('{0}' as System.DateTime)", DateTime.Parse(txtBeginInitialTime.Text));
//            }
//            if (txtEndInitialTime.Text != "")
//            {
//                condition += string.Format(" and it.InitialTime <= cast('{0}' as System.DateTime)", DateTime.Parse(txtEndInitialTime.Text).AddDays(1));
//            }
//            if (txtReceiver.Text != "")
//            {
//                condition += string.Format(" and it.Receiver like '%{0}%'", txtReceiver.Text.Trim());
//            }
//            if (txtSendAddress.Text != "")
//            {
//                condition += string.Format(" and it.SendAddress like '%{0}%'", txtSendAddress.Text.Trim());
//            }
//            if (txtReceiveAddress.Text != "")
//            {
//                condition += string.Format(" and it.ReceiveAddress like '%{0}%'", txtReceiveAddress.Text.Trim());
//            }
//            if (ddlProjectType.SelectedIndex != 0)
//            {
//                condition += string.Format(" and it.ProjectTypeName = '{0}'", ddlProjectType.SelectedItem.Text);
//            }
//            if (!string.IsNullOrEmpty(ProjectChildTypeID.SelectedValue))
//            {
//                condition += string.Format(" and it.ProjectChildTypeID = '{0}'", ProjectChildTypeID.SelectedValue);
//            }
//            if (ddlSupplier.SelectedIndex != 0)
//            {
//                condition += string.Format(" and it.SupplierID = '{0}'", ddlSupplier.SelectedValue);
//            }
//            if (ddlStatus.SelectedIndex != 0)
//            {
//                condition += string.Format(" and it.Status = '{0}'", ddlStatus.SelectedValue);
//            }

//            if (!String.IsNullOrEmpty(Request["IsPayed"]))
//            {
//                if (Request["IsPayed"] == "1")
//                {
//                    condition += " and it.IsPayed = true";   
//                }else
//                {
//                    condition += " and (it.IsPayed = false or it.IsPayed is null)";   
//                }
//            }

//            //超时
//            if (FormType == "delay")
//            {
//                //包括送达超时和回单超时
//                //送达超时条件：1）送达超时没有及时回复；2）当前时间距离下单时间已经超过一定天数；3）送达时间为空空或者送达时间距离下单时间超过一定天数
//                //回单超时条件：1）需要回单；2）回单超时没有及时回复；3）送达时间不为空；4）当前时间距离送达时间超过一定天数；5）回单时间为空或者回单时间距离送达时间超过一定天数
//                condition += string.Format(@"
// and it.IsReplyIntime_DelayArrive is null 
// and 
//(
//(DiffDays(it.InitialTime,CurrentDateTime())>{0} 
//and (it.ArriveTime is null or DiffDays(it.InitialTime,it.ArriveTime)>{0}))
//or
//(it.IsBack = true and it.ArriveTime is not null
//and DiffDays(it.ArriveTime,CurrentDateTime())>{0} 
//and (it.BackTime is null or DiffDays(it.ArriveTime,it.BackTime)>{0}))
//)", NormalDelay);
//            }

//            //预警
//            if (FormType == "warning")
//            {
//                //包括送达预警和回单预警
//                //送达预警条件：1）送达时间为空；2）当前时间与下单时间间隔超过一定天数但还没超时
//                //回单预警条件：1）需要回单；2）回单时间为空；3）当前时间与送达时间间隔超过一定天数但还没超时
//                condition += string.Format(@"
// and 
//(
//(it.ArriveTime is null and DiffDays(it.InitialTime,CurrentDateTime())>{0} and DiffDays(it.InitialTime,CurrentDateTime())<={1})
//or
//(it.IsBack = true and it.BackTime is null and DiffDays(it.ArriveTime,CurrentDateTime())>{0} and DiffDays(it.ArriveTime,CurrentDateTime())<={1})
//)", DelayWarning,NormalDelay);
//            }

//            //催办
//            if (FormType == "urge")
//            {
//                condition += " and it.UrgeTime is not null";
//            }

//            //投诉
//            if (FormType == "complain")
//            {
//                condition += " and it.ComplainTime is not null";
//            }

//            //未打印
//            if (FormType == "unPrint")
//            {
//                condition += " and it.PrintTime is null";
//            }

//            //未送达
//            if (FormType == "unArrive")
//            {
//                condition += " and it.ArriveTime is null";
//            }

//            //未回单
//            if (FormType == "unBack")
//            {
//                condition += " and it.IsBack = true and it.ArriveTime is not null and it.BackTime is null";
//            }

//            //收件区域
//            if (ddlArea.SelectedItem.Text == "市内")
//            {
//                condition += " and it.ReceiveCity='440100' and it.ReceiveArea not in{'440183','440184','440113','440114','440107'}";
//            }
//            if (ddlArea.SelectedItem.Text == "市郊")
//            {
//                condition += " and it.ReceiveArea in {'440183','440184','440113','440114','440107'}";
//            }
//            if (ddlArea.SelectedItem.Text == "省内")
//            {
//                condition += " and it.ReceiveProvince='440000' and it.ReceiveCity!='440100'";
//            }
//            if (ddlArea.SelectedItem.Text == "国内")
//            {
//                condition += " and it.ReceiveProvince not in{'440000','660000','670000','680000','990000'}";
//            }
//            if (ddlArea.SelectedItem.Text == "国际")
//            {
//                condition += " and it.ReceiveProvince in {'660000','670000','680000','990000'}";
//            }

//            return condition;
//        }

//        protected void projectType_Change(object sender, EventArgs e)
//        {
//            if(string.IsNullOrEmpty(ddlProjectType.SelectedValue))
//            {
//                this.ProjectChildTypeID.DataSource = new List<PS_ProjectTypes>();
//            }else
//            {
//                this.ProjectChildTypeID.DataSource = new ProjectTypeService().GetChildTypes(ddlProjectType.SelectedValue);
//            }
//            this.ProjectChildTypeID.DataBind();
//            ListItem item  = new ListItem();
//            item.Text = "全部";
//            item.Value = "";
//            this.ProjectChildTypeID.Items.Insert(0,item);
//        }


        protected void btnSearch_Click(object sender, EventArgs e)
        {
            Search();
        }

        /// <summary>
        /// 翻页
        /// </summary>
        /// <param name="sender"></param>
        /// <param name="e"></param>
        protected void pager_PageChanged(object sender, EventArgs e)
        {
            //string id = null;
            //HtmlInputCheckBox cb = null;
            //foreach (GridViewRow gr in gvList.Rows)
            //{
            //    cb = (HtmlInputCheckBox)gr.Cells[0].FindControl("chkItem");
            //    id = cb.Attributes["value"].Split(',')[0];
            //    if (cb.Checked)
            //    {
            //        ViewState[id] = id;
            //    }
            //    else
            //    {
            //        if (ViewState[id] != null)
            //        {
            //            ViewState.Remove(id);
            //        }
            //    }
            //}
            Search();
        }

//        protected void gvList_RowDataBound(object sender, GridViewRowEventArgs e)
//        {
//            if (e.Row.RowType == DataControlRowType.DataRow)
//            {
//                PS_Orders order = Orders[e.Row.RowIndex];


//                //转换配送状态
//                SYS_Enums obj = StatusList.First(p => p.EnumCode.Equals(e.Row.Cells[4].Text));
//                if (obj != null)
//                    e.Row.Cells[4].Text = obj.EnumName;

//                //超时
//                if (FormType == "delay")
//                {
//                    //送达超时
//                    DateTime compareTime = order.ArriveTime == null ? DateTime.Now : (DateTime)order.ArriveTime;
//                    TimeSpan span = compareTime - (DateTime)order.InitialTime;
//                    if (span.Days > 10)
//                    {
//                        e.Row.Cells[11].Text = "严重超时";
//                        e.Row.Style.Add(HtmlTextWriterStyle.Color, "Red");
//                    }
//                    else
//                    {
//                        e.Row.Cells[11].Text = "普通超时";
//                    }

//                    //回单超时
//                    if (order.IsBack != null && (bool)order.IsBack && order.ArriveTime != null)
//                    {
//                        compareTime = order.BackTime == null ? DateTime.Now : (DateTime)order.BackTime;
//                        span = compareTime - (DateTime)order.ArriveTime;
//                        if (span.Days > 10)
//                        {
//                            e.Row.Cells[14].Text = "严重超时";
//                            e.Row.Style.Add(HtmlTextWriterStyle.Color, "Red");
//                        }
//                        else
//                        {
//                            e.Row.Cells[14].Text = "普通超时";
//                        }
//                    }
//                }

//                //收件区域
//                Label lbReceiveArea = e.Row.FindControl("lbReceiveArea") as Label;
//                if (order.ReceiveCity == "440100")//广州市
//                {
//                    if (order.ReceiveArea == "440183" || order.ReceiveArea == "440184" || order.ReceiveArea == "440113"
//                        || order.ReceiveArea == "440114" || order.ReceiveArea == "440107")//增城，从化，番禺，花都，南沙
//                    lbReceiveArea.Text = "市郊";
//                    else
//                        lbReceiveArea.Text = "市内";
//                }
//                else if (order.ReceiveProvince == "440000" && order.ReceiveCity != "440100")
//                    lbReceiveArea.Text = "省内";
//                else if (order.ReceiveProvince != "440000" && order.ReceiveProvince != "660000" && order.ReceiveProvince != "670000"
//                    && order.ReceiveProvince != "680000"  && order.ReceiveProvince != "990000")
//                    lbReceiveArea.Text = "国内";
//                else
//                    lbReceiveArea.Text = "国际";
//            }
//        }

//        protected void PrintClick(object sender, EventArgs e)
//        {
//            string id = null;
//            HtmlInputCheckBox cb = null;
//            StringBuilder idBuilder = new StringBuilder(); 
//            foreach (GridViewRow gr in gvList.Rows)//改成只打一页，按页面顺序打印出来
//            {
//                cb = (HtmlInputCheckBox)gr.Cells[0].FindControl("chkItem");
//                id = cb.Attributes["value"].Split(',')[0];
//                //if (cb.Checked)
//                //{
//                //    ViewState[id] = id;
//                //}
//                //else
//                //{
//                //    if (ViewState[id] != null)
//                //    {
//                //        ViewState.Remove(id);
//                //    }
//                //}
//                if (cb.Checked)
//                    idBuilder.Append(id).Append("~");
//            }
            
//            //foreach (string orderId in ViewState.Keys)
//            //{
//            //    idBuilder.Append(orderId).Append("~");
//            //}

//            if(idBuilder.Length > 0)
//            {
//                ClientHelper.Instance.RenderScript(Page, "", String.Format("printOrder('{0}')", idBuilder.ToString()));
//            }
//        }

//        protected void ExportClick(object sender, EventArgs e)
//        {
//            string condition = GetConditionForExport();

//            Dictionary<string, DataTable[]> forms = new Dictionary<string, DataTable[]>();
//            List<DataTable> tables = OrderFormService.GetOrdersTable(SystemContext.Current.LoginAuthUser, condition,
//                                                                     FormType);
//            if(tables==null)
//            {
//                ClientHelper.Instance.Alert("导出记录数超过Excel的最大行数（65535），请先筛选数据，分多次导出，谢谢。");
//                return;
//            }

//            forms.Add(Convert.ToString("配送单明细"), tables.ToArray());

//            ClientHelper.Instance.ExportToExcel(forms, "配送单明细");
//        }

//        protected string GetConditionForExport()
//        {
//            string condition = "";

//            string inputOrderNo = txtOrderNo.Text.Replace(",", "").Replace("'", "").Trim();
//            using (StringReader sr = new StringReader(inputOrderNo))
//            {
//                StringBuilder inString = new StringBuilder();
//                string strLineData;
//                int i = 0;
//                while ((strLineData = sr.ReadLine())!=null)
//                {
//                    if (strLineData.Trim() != "")
//                    {
//                        strLineData = strLineData.Trim();
//                        inString.Append("'" + strLineData + "',");
//                        i++;
//                    }
//                }
//                if (i > 1)
//                {
//                    condition += " and it.OrderNo in (" + inString.ToString().Substring(0, inString.Length - 1) + ")";
//                }
//                else
//                {
//                    if (txtOrderNo.Text != "")
//                    {
//                        condition += string.Format(" and it.OrderNo like '%{0}%'", txtOrderNo.Text.Trim());
//                    }
//                }
//            }

//            string inputSourceNo = txtSourceNo.Text.Replace(",", "").Replace("'", "").Trim();
//            using (StringReader sr = new StringReader(inputSourceNo))
//            {
//                StringBuilder inString = new StringBuilder();
//                string strLineData;
//                int i = 0;
//                while ((strLineData = sr.ReadLine())!=null)
//                {
//                    if (strLineData.Trim() != "")
//                    {
//                        strLineData = strLineData.Trim();
//                        inString.Append("'" + strLineData + "',");
//                        i++;
//                    }
//                }
//                if (i > 1)
//                {
//                    condition += " and it.SourceNo in (" + inString.ToString().Substring(0, inString.Length - 1) + ")";
//                }
//                else
//                {
//                    if (txtSourceNo.Text != "")
//                    {
//                        condition += string.Format(" and it.SourceNo like '%{0}%'", txtSourceNo.Text.Trim());
//                    }
//                }
//            }

//            string inputCarryNo = txtCarryNo.Text.Replace(",", "").Replace("'", "").Trim();
//            using (StringReader sr = new StringReader(inputCarryNo))
//            {
//                StringBuilder inString = new StringBuilder();
//                string strLineData;
//                int i = 0;
//                while ((strLineData = sr.ReadLine())!=null)
//                {
//                    if (strLineData.Trim() != "")
//                    {
//                        strLineData = strLineData.Trim();
//                        inString.Append("'" + strLineData + "',");
//                        i++;
//                    }
//                }
//                if (i > 1)
//                {
//                    condition += " and it.CarryNo in (" + inString.ToString().Substring(0, inString.Length - 1) + ")";
//                }
//                else
//                {
//                    if (txtCarryNo.Text != "")
//                    {
//                        condition += string.Format(" and it.CarryNo like '%{0}%'", txtCarryNo.Text.Trim());
//                    }
//                }
//            }
//            if (txtApplier.Text != "")
//            {
//                condition += string.Format(" and it.Applier like '%{0}%'", txtApplier.Text);
//            }
//            if (txtApplierBigDept.Text != "")
//            {
//                condition += string.Format(" and it.ApplierBigDept like '%{0}%'", txtApplierBigDept.Text);
//            }

//            if (this.txtBeginInitialTime.Text.Trim() != "" && this.txtEndInitialTime.Text.Trim() != "")
//            {
//                DateTime dt = DateTime.Parse(this.txtEndInitialTime.Text.Trim());
//                dt = dt.AddDays(1);
//                condition += string.Format(" AND it.InitialTime>='{0}' AND it.InitialTime<'{1}'",
//                                           this.txtBeginInitialTime.Text.Trim(), dt.ToString());
//            }
//            if (this.txtBeginInitialTime.Text.Trim() != "")
//            {
//                condition += string.Format(" AND it.InitialTime>='{0}'", this.txtBeginInitialTime.Text.Trim());
//            }
//            if (this.txtEndInitialTime.Text.Trim() != "")
//            {
//                DateTime dt = DateTime.Parse(this.txtEndInitialTime.Text.Trim());
//                dt = dt.AddDays(1);
//                condition += string.Format(" AND it.InitialTime<'{0}'", dt.ToString());
//            }
//            if (txtReceiver.Text != "")
//            {
//                condition += string.Format(" and it.Receiver like '%{0}%'", txtReceiver.Text);
//            }
//            if (txtSendAddress.Text != "")
//            {
//                condition += string.Format(" and it.SendAddress like '%{0}%'", txtSendAddress.Text);
//            }
//            if (txtReceiveAddress.Text != "")
//            {
//                condition += string.Format(" and it.ReceiveAddress like '%{0}%'", txtReceiveAddress.Text);
//            }
//            if (ddlProjectType.SelectedIndex != 0)
//            {
//                condition += string.Format(" and it.ProjectTypeName = '{0}'", ddlProjectType.SelectedItem.Text);
//            }
//            if (!string.IsNullOrEmpty(ProjectChildTypeID.SelectedValue))
//            {
//                condition += string.Format(" and it.ProjectChildTypeID = '{0}'", ProjectChildTypeID.SelectedValue);
//            }
//            if (ddlSupplier.SelectedIndex != 0)
//            {
//                condition += string.Format(" and it.SupplierID = '{0}'", ddlSupplier.SelectedValue);
//            }
//            if (ddlStatus.SelectedIndex != 0)
//            {
//                condition += string.Format(" and it.Status = '{0}'", ddlStatus.SelectedValue);
//            }
//            //超时
//            if (FormType == "delay")
//            {
//                //包括送达超时和回单超时
//                //送达超时条件：1）送达超时没有及时回复；2）当前时间距离下单时间已经超过一定天数；3）送达时间为空空或者送达时间距离下单时间超过一定天数
//                //回单超时条件：1）需要回单；2）回单超时没有及时回复；3）送达时间不为空；4）当前时间距离送达时间超过一定天数；5）回单时间为空或者回单时间距离送达时间超过一定天数
//                condition +=
//                    string.Format(
//                        @"
//                         and it.IsReplyIntime_DelayArrive is null 
//                         and 
//                        (
//                        (DATEDIFF(day,it.InitialTime,GETDATE())>{0} 
//                        and (it.ArriveTime is null or DATEDIFF(day,it.InitialTime,it.ArriveTime)>{0}))
//                        or
//                        (it.IsBack = 1 and it.ArriveTime is not null
//                        and DATEDIFF(day,it.ArriveTime,GETDATE())>{0} 
//                        and (it.BackTime is null or DATEDIFF(day,it.ArriveTime,it.BackTime)>{0}))
//                        )",
//                        NormalDelay);
//            }

//            //预警
//            if (FormType == "warning")
//            {
//                //包括送达预警和回单预警
//                //送达预警条件：1）送达时间为空；2）当前时间与下单时间间隔超过一定天数但还没超时
//                //回单预警条件：1）需要回单；2）回单时间为空；3）当前时间与送达时间间隔超过一定天数但还没超时
//                condition +=
//                    string.Format(
//                        @" and 
//                            (
//                            (it.ArriveTime is null and DATEDIFF(day,it.InitialTime,GETDATE())>{0} and DATEDIFF(day,it.InitialTime,GETDATE())<={1})
//                            or
//                            (it.IsBack = 1 and it.BackTime is null and DATEDIFF(day,it.ArriveTime,GETDATE())>{0} and DATEDIFF(day,it.ArriveTime,GETDATE())<={1})
//                            )",
//                        DelayWarning, NormalDelay);
//            }

//            //催办
//            if (FormType == "urge")
//            {
//                condition += " and it.UrgeTime is not null";
//            }

//            //投诉
//            if (FormType == "complain")
//            {
//                condition += " and it.ComplainTime is not null";
//            }

//            //未打印
//            if (FormType == "unPrint")
//            {
//                condition += " and it.PrintTime is null";
//            }

//            //未送达
//            if (FormType == "unArrive")
//            {
//                condition += " and it.ArriveTime is null";
//            }

//            //未回单
//            if (FormType == "unBack")
//            {
//                condition += " and it.IsBack = 1 and it.ArriveTime is not null and it.BackTime is null";
//            }

//            //收件区域
//            if (ddlArea.SelectedItem.Text == "市内")
//            {
//                condition += " and it.ReceiveCity='440100' and it.ReceiveArea not in('440183','440184','440113','440114','440107')";
//            }
//            if (ddlArea.SelectedItem.Text == "市郊")
//            {
//                condition += " and it.ReceiveArea in ('440183','440184','440113','440114','440107')";
//            }
//            if (ddlArea.SelectedItem.Text == "省内")
//            {
//                condition += " and it.ReceiveProvince='440000' and it.ReceiveCity!='440100'";
//            }
//            if (ddlArea.SelectedItem.Text == "国内")
//            {
//                condition += " and it.ReceiveProvince not in('440000','660000','670000','680000','990000')";
//            }
//            if (ddlArea.SelectedItem.Text == "国际")
//            {
//                condition += " and it.ReceiveProvince in ('660000','670000','680000','990000')";
//            }

//            return condition;
//        }

//        protected void FeedbackClick(object sender, EventArgs e)
//        {
//            string id = null;
//            HtmlInputCheckBox cb = null;
//            foreach (GridViewRow gr in gvList.Rows)
//            {
//                cb = (HtmlInputCheckBox)gr.Cells[0].FindControl("chkItem");
//                id = cb.Attributes["value"].Split(',')[0];
//                DropDownList dt;
//                if (cb.Checked)
//                {
//                    ViewState[id] = id;
//                }
//                else
//                {
//                    if (ViewState[id] != null)
//                    {
//                        ViewState.Remove(id);
//                    }
//                }
//            }
//            StringBuilder idBuilder = new StringBuilder();
//            foreach (string orderId in ViewState.Keys)
//            {
//                idBuilder.Append(orderId).Append("~");
//            }

//            if (idBuilder.Length > 0)
//            {
//                ClientHelper.Instance.RenderScript(Page, "", String.Format("feedbackOrder('{0}')", idBuilder.ToString()));
//            }
//        }
    }
}